<template>
    <div style="text-align: center">
        <div v-wechat-title="$route.meta.title"></div>
        <h1 style="color: cornflowerblue; font-size: 30px">Welcome</h1>
        <el-card class="box">
            <h3>统计</h3>
            <el-descriptions border :column="2">
                <el-descriptions-item label="入驻商家数"
                    ><el-tag type="primary" style="cursor:pointer" @click="saveNavState('3-1', '/buslist')">{{
                        info.busCount
                    }}</el-tag></el-descriptions-item
                >
                <el-descriptions-item label="当前用户数"
                    ><el-tag type="primary" style="cursor:pointer" @click="saveNavState('2-1', '/userlist')">{{
                        info.userCount
                    }}</el-tag></el-descriptions-item
                >
                <el-descriptions-item label="上架商品数"
                    ><el-tag type="primary" style="cursor:pointer" @click="saveNavState('6-1', '/goodslist')">{{
                        info.goodCount
                    }}</el-tag></el-descriptions-item
                >
                <el-descriptions-item label="当前订单数"
                    ><el-tag type="primary" style="cursor:pointer" @click="saveNavState('7-1', '/orderlist')">{{
                        info.orderCount
                    }}</el-tag></el-descriptions-item
                >
            </el-descriptions>
        </el-card>
    </div>
</template>

<script>
export default {
    name: 'Welcome',
    data() {
        return {
            info: [],
        };
    },
    created() {
        this.getinfo();
    },
    methods: {
        getinfo() {
            this.$http
                .get('/getShopDetail')
                .then((res) => {
                    this.info = res.data.data;
                })
                .catch((err) => {
                    console.log(err);
                });
        },
        // 保存连接激活状态
        saveNavState(activepath, url) {
            window.sessionStorage.setItem('activepath', activepath);
            this.activepath = activepath;
            this.$router.push(url);
        },
    },
};
</script>


<style scoped>
.box {
    height: 500px;
}
</style>
